#include "pch.h"
#include <stdio.h>

int isChinese(char c)
{
	return (c & 0x80) != 0;
}

int main()
{
	char str[100];
	int p = 0, bl = 0, cn = 0, en = 0, num = 0, at = 0;
	printf("请输入你的字符串：");
	gets_s(str, 100);
	while (str[p] != '\0')
	{
		bl = isChinese(str[p]);
		if (bl == 1)
		{
			cn++;
			p = p + 2;
			continue;
		}
		if (str[p] >= 'A'&&str[p] <= 'Z' || str[p] >= 'a'&&str[p] <= 'z')
			en++;
		if (str[p] >= '0'&&str[p] <= '9')
			num++;
		if (str[p] >= '!'&&str[p] <= '/' || str[p] >= ':'&&str[p] <= '@' || str[p] >= '['&&str[p] <= '`' || str[p] >= '{'&&str[p] <= '~')
			at++;
		p++;
	}

	printf("所含汉字%d，英文字母%d，数字%d，字符%d", cn, en, num, at);
}